<template>
  <div class="inline">
    <el-slider v-bind="$attrs" v-on="$listeners" v-model="value" @change="$emit('change',value)" class="slider" :show-tooltip="false"></el-slider>
    <div class="userTooltip" :style="{left: `${value}%`}">
      {{100-value}}%
      <div class="navs"></div>
    </div>
  </div>
</template>

<script>
export default {
  model: {
    prop: "value",
    event: "change"
  },
  props: {
    value: {
      type: Number,
      default: 0
    }
  }
};
</script>

<style lang="less" scoped>
.inline {
    width: 230px;
    position: relative;
    .userTooltip {
      background: transparent;
      color: #000 !important;
      width: 60px;
      margin-left: -30px;
      border-radius: 4px;
      text-align: center;
      padding: 8px 0;
      position: absolute;
      top: -30px;
      .navs {
        height: 0;
        width: 0;
        border: 5px solid transparent;
        border-top-color: #fff;
        position: absolute;
        bottom: -9px;
        left: 50%;
        margin-left: -5px;
        z-index: 99;
      }
    }
}
</style>